/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package crm.ui.tapestry.controller;

import com.javaforge.tapestry.spring.annotations.InjectSpring;
import crm.entity.Client;
import crm.service.AppService;
import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.record.PropertyChangeObserver;

/**
 *
 * @author abet
 */
public abstract class ClientController extends BasePage{
    private Client client= new Client();

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    public List<Client> getDaftarClient() {
        daftarClient=getAppService().findAllClient();
        return daftarClient;
    }

    public void setDaftarClient(List<Client> daftarClient) {
        this.daftarClient = daftarClient;
    }
    private List<Client> daftarClient = new ArrayList<Client>();
    
    @InjectSpring("appService")
    public abstract AppService getAppService();
   
    
    public String saveClient(){
        getAppService().saveClient(client);
        client=new Client();
        System.out.println("method simpan Client ditekan");
        return "DaftarClient";
        }
    public void deleteClient(){
        getAppService().deleteClient(client);
           }
    
    public PropertyChangeObserver getPropertyChangeObserver() {
       return null;
        
    }
    
    
    

 
}